#!/bin/sh

[ -e "/etc/openvpn.user" ] && {
	env -i ACTION="$ACTION" INSTANCE="$INSTANCE" \
		/bin/sh \
		/etc/openvpn.user \
		$*
}

# Wrap user defined scripts on up/down events
case "$ACTION" in
	up) command=$user_up ;;
	down) command=$user_down ;;
	*) command= ;;
esac

if [ -n "$command" ]; then
	shift
	exec /bin/sh -c "$command $*"
fi

exit 0
